*******************************************************************************
* Oak Park
*******************************************************************************

use "dataset_other_oak_park", clear

su pctnhblack
gen x = (pctnhblack - r(min)) / (r(max) - r(min))
reg pctyes x [aw=totalvotes], robust
local b = string(_b[x], "%20.02fc")
local se = string(_se[x], "%20.02fc")

#delimit;

gr tw
	(sc pctyes pctnhblack [aw=totalvotes], msym(Oh) msize(tiny) col(gray))
	(lpoly pctyes pctnhblack [aw=totalvotes], col(black) lwid(thick))
	,
		plotregion(style(none))
		ylab(, angle(horiz))
		xtitle("Share Black")
		ytitle("Share Yes Vote (Yes=Defund)")
		title("Oak Park, Illinois")
		subtitle({&beta} = `b' (`se'))
		legend(off)
		;

#delimit cr

gr export "_output/figure A24 a.pdf", replace

*******************************************************************************
* Oklahoma City
*******************************************************************************

use "dataset_other_oklahoma_city", clear

foreach year in 2007 2017 {

	preserve
	
		keep if year == `year'

		su pctnhblack
		gen x = (pctnhblack - r(min)) / (r(max) - r(min))
		reg pctyes x [aw=totalvotes], robust
		local b = string(_b[x], "%20.02fc")
		local se = string(_se[x], "%20.02fc")

		#delimit;

		gr tw
			(sc pctyes pctnhblack [aw=totalvotes], 
				msym(Oh) msize(tiny) col(gray))
			(lpoly pctyes pctnhblack [aw=totalvotes], 
				col(black) lwid(thick))
			,
				legend(off)
				plotregion(style(none))
				ylab(, angle(horiz))
				xtitle("")
				ytitle("")
				yline(0.5, lpat(dash))
				name(g`year', replace)
				title(`year')
				subtitle({&beta} = `b' (`se'))
				;

		#delimit cr
	
	restore
	
	gr close

}

gr combine g2007 g2017, title("Oklahoma City, Oklahoma") ///
	b1title("Share Black") l1title("Share Yes Vote")			

gr export "_output/figure A24 b.pdf", replace

*******************************************************************************
* End
*******************************************************************************
